import Vue from 'vue'
import VueRouter from 'vue-router'


// 去掉路由重定向的那个的报错信息
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
    if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
    return originalPush.call(this, location).catch(err => err)
}


Vue.use(VueRouter)

// 项目初始话默认
// const routes = [{
//         path: '/',
//         name: 'Home',
//         component: Home
//     },
//     {
//         path: '/about',
//         name: 'About',
//         // route level code-splitting
//         // this generates a separate chunk (about.[hash].js) for this route
//         // which is lazy-loaded when the route is visited.
//         component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
//     }
// ]


const router = new VueRouter({
    routes: [
        {
            path: '/login',
            name: 'Login',
            component: () => import('@/views/entry/Login'),
        },
    ]
})



router.beforeEach((to, from, next) => {
    if(store.state.auth.loginState == 0) {
        next()
    }
    


})

export default router
